<?php

    class ElementTableBrowseInsert extends Element {
        public function Render( $color ) {
            global $table;

            $fields = $table->Fields;

            ?><tr class="insert<?php
                if ( $color ) {
                    ?> t<?php
                }
                ?>"><?php
                
                $first = true;
                foreach ( $fields as $field ) {
                    ?><td<?php
                    if ( $first || $field->IsAutoIncrement ) {
                        ?> class="<?php
                        if ( $first ) {
                            ?>n <?php
                        }
                        if ( $field->IsAutoIncrement ) {
                            ?>insertai<?php
                        }
                        ?>"<?php
                    }
                    ?>><?php
                    
                    if ( $first ) {
                        ?><a href="" onclick="Rows.Insert( this.parentNode.parentNode ); return false;" title="Save"><img class="insert" src="images/table_row_insert.png" alt="insert:" title="Insert row" /></a><?php
                        $first = false;
                    }
                    
                    if ( $field->IsAutoIncrement ) {
                        ?><input type="text" value="?" title="Specify a custom value for this auto-increment field" /><?php
                    }
                    else {
                        ?><input type="text" /><?php
                    }

                    if ( $field->Type == DB_TYPE_DATETIME || $field->Type == DB_TYPE_DATE ) {
                       ?><a href="" onclick="Calendar.Pick( this ); return false;"><img src="images/calendar.png" alt="calendar" title="Pick a date" /></a><?php
                    }

                    ?></td><?php
                }

            ?></tr><?php
        }
    }

?>
